package dtos;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class UserDTO implements Serializable, Comparable<UserDTO> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3626597734333860098L;
	private int id;
	private String username;
	private String password;
	private String name;
	private String email;
	private int idDomain;
	private int idUsertype;
	private int isActive;
	private String ip;
	private String status;
	private int idUser;
	private List<Integer> tickets = new ArrayList<>();
	private List<Integer> responses = new ArrayList<>();
	private List<Integer> userlogs = new ArrayList<>();

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public int getIdDomain() {
		return idDomain;
	}

	public void setIdDomain(int idDomain) {
		this.idDomain = idDomain;
	}

	
	/**
	 * @return the idUsertype
	 */
	public int getIdUsertype() {
		return idUsertype;
	}

	/**
	 * @param idUsertype the idUsertype to set
	 */
	public void setIdUsertype(int idUsertype) {
		this.idUsertype = idUsertype;
	}

	public int getIsActive() {
		return isActive;
	}

	public void setIsActive(int isActive) {
		this.isActive = isActive;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 * @return the idUser
	 */
	public int getIdUser() {
		return idUser;
	}

	/**
	 * @param idUser
	 *            the idUser to set
	 */
	public void setIdUser(int idUser) {
		this.idUser = idUser;
	}

	public List<Integer> getTickets() {
		return tickets;
	}

	public void setTickets(List<Integer> tickets) {
		this.tickets = tickets;
	}

	public List<Integer> getResponses() {
		return responses;
	}

	public void setResponses(List<Integer> responses) {
		this.responses = responses;
	}

	public List<Integer> getUserlogs() {
		return userlogs;
	}

	public void setUserlogs(List<Integer> userlogs) {
		this.userlogs = userlogs;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof UserDTO))
			return false;
		UserDTO other = (UserDTO) obj;
		if (id != other.id)
			return false;
		return true;
	}
	


	public void addUserlogs(Integer u)
	{
		userlogs.add(u);
	}
	
	public void addResponses(Integer r)
	{
		responses.add(r);
	}
	
	public void addTickets(Integer t)
	{
		tickets.add(t);
	}

	@Override
	public int compareTo(UserDTO u) {
		return this.getIp().compareTo(u.getIp());
	}

	@Override
	public String toString() {
		return "UserDTO [id=" + id + ", username=" + username + ", password="
				+ password + ", name=" + name + ", email=" + email
				+ ", idDomain=" + idDomain + ", idUsertype=" + idUsertype
				+ ", isActive=" + isActive + ", ip=" + ip + ", status="
				+ status + ", idUser=" + idUser + ", tickets=" + tickets
				+ ", responses=" + responses + ", userlogs=" + userlogs + "]";
	}
	
}
